package com.czy.owner.api;

import com.czy.owner.db.UserHelper;
import com.czy.owner.global.Constants;
import com.czy.owner.net.api.BaseApi;
import com.czy.owner.net.listener.HttpOnNextListener;
import com.trello.rxlifecycle.components.support.RxAppCompatActivity;

import java.util.HashMap;

import retrofit2.Retrofit;
import rx.Observable;

/**
 * Created by King on 2017-06-06
 */

public class GetUserOrderCouponsApi extends BaseApi {
    private HashMap<String,Object> map = new HashMap<>();
    public GetUserOrderCouponsApi(HttpOnNextListener listener, RxAppCompatActivity rxAppCompatActivity) {
        super(listener, rxAppCompatActivity);
        setCache(true);
        setMothed(UserHelper.getInstance().getUserAccount() + Constants.OWN_ORDER_COUPONS);//相当于缓存保存的Key
        setCookieNetWorkTime(0);//有网缓存0s,在0s内点击无效
        setCookieNoNetWorkTime(0);//无网缓存0天
        setShowProgress(true);
        setCancel(false);
    }
    public void setMap(HashMap<String, Object> map) {
        this.map = map;
    }
    @Override
    public Observable getObservable(Retrofit retrofit) {
        return retrofit.create(HttpPostService.class).getUserOrderCoupons(map);
    }
}
